package com.wanfeng.common.exception;

//自定义异常

import com.wanfeng.common.ResultCodeEnum;
import lombok.Data;

@Data
public class WanfengException extends RuntimeException{

    private Integer code;
    private String message;

    public WanfengException(Integer code,String message){
        this.code=code;
        this.message=message;
    }
    /**
     * 接收枚举类型对象
     * @param resultCodeEnum
     */
    public WanfengException(ResultCodeEnum resultCodeEnum){
        this.code=resultCodeEnum.getCode();
        this.message=resultCodeEnum.getMessage();
    }


    @Override
    public String toString() {
        return "WanfengException{" +
                "code=" + code +
                ", message='" + message + '\'' +
                '}';
    }
}
